<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <f:metadata>
        <f:event type="preRenderView" listener="#{sessionManaged.validar_session('wfrmArea')}"/>
    </f:metadata>
    <body>

        <ui:composition template="./../../../template.xhtml">
            <ui:define name="main_content">
                <div align="left" >
                    <ui:include src="/web-pages/OTROS/HELP/wfrmHelp_mtto.xhtml">
                        <ui:param name="toolBarWidth" value="750"/>
                        <ui:param name="toolBarTitleWidth" value="700"/>
                        <ui:param name="title" value="&Aacute;rea"/>
                    </ui:include>
                    <p:panel header="Informaci&oacute;n de &Aacute;rea" style="width: 750px"  >

                        <ui:include src="/web-pages/OTROS/wfrmMensaje.xhtml"/>
                        <h:form id="area">
                            <h:panelGrid id="pArea" columns="2" style="width: inherit"  >
                                <h:outputText value="&Aacute;rea de Trabajo: "/>
                                <p:inputText value="#{areaManaged.selectedArea.nombre}" style="width: 350px" />
                            </h:panelGrid>
                            <div align="center">
                                <h:panelGrid id="cmdButtones" columns="2" cellpadding="5" style="width:inherit">
                                    <p:commandButton value="#{sms.guardar}" onclick="cmdConfirm.show()" image="ui-icon ui-icon-check"/>
                                    <p:commandButton value="#{sms.limpiar}" actionListener="#{limpiarManaged.limpiar}" update="area:pArea grid:table"/>
                                    <p:confirmDialog message="#{sms.iAlmacenada}" header="#{sms.guardar}" severity="alert" widgetVar="cmdConfirm">
                                        <p:commandButton value="Si" actionListener="#{areaManaged.AreaMantenimiento}" update="grid:table area:pArea mensaje" oncomplete="cmdConfirm.hide()" />
                                        <p:commandButton value="No" onclick="cmdConfirm.hide()" />
                                    </p:confirmDialog>
                                </h:panelGrid>
                            </div>
                        </h:form>

                        <h:form id="grid">
                            <p:panel header="Datos de &Aacute;rea" style="width: inherit" >
                                <f:facet name="header">
                                    <h:outputText value="Datos de &Aacute;rea "/>
                                    <p:commandButton image="ui-icon ui-icon-search" actionListener="#{areaManaged.fillGrid}" title="Buscar &Aacute;rea" update="grid:table mensaje"/>
                                </f:facet>

                                <p:dataTable id="table" value="#{areaManaged.areas}" var="row" rows="10" paginator="true"
                                             paginatorPosition="bottom" selectionMode="single" selection="#{areaManaged.selectedArea}"
                                             emptyMessage="#{sms.TableEmptyMessage}" onRowSelectUpdate="area:pArea">
                                    <f:facet name="header"><h:outputText value="Lista de &Aacute;reas" /></f:facet>
                                    <p:column filterBy="#{row.nombre}" filterMatchMode="contains" colspan="2"  headerText="&Aacute;rea">
                                        <h:outputText  value="#{row.nombre}" />
                                    </p:column>
                                </p:dataTable>
                            </p:panel>
                        </h:form>
                    </p:panel>
                </div>
            </ui:define>
        </ui:composition>
    </body>
</html>
